﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        bussiness bus = new bussiness();
        List<Admins> lstAdmin = bus.getAllAdmin();
        bool flag = true;
        foreach (Admins ad in lstAdmin)
        { 
            if(ad.Username == txtUsername.Text && ad.Password == txtPassword.Text)
            {
                flag = false;
                Session["admin"] = ad;
                Response.Redirect("Statistics.aspx");
            }
        }
        if(flag)
        {
            lblError.Text = "username or password not valid";
        }
    }
}